package exam.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/4/10 15:20
 */
public class HJ17 {
    /* public static void main(String[] args) {
         Scanner in = new Scanner(System.in);
         String str = in.next();
         String[] split = str.split(";");
         int row = 0, col = 0;
         for (String s : split) {
             if (s.length() <= 1 || s.length() > 3)
                 continue;
             char position = s.charAt(0);
             if (position != 'A' && position != 'W' && position != 'S'&& position != 'D')
                 continue;
             if (s.charAt(1) < '0' || s.charAt(1) > '9')
                 continue;
             if (s.length() == 3 && (s.charAt(2) < '0' || s.charAt(2) > '9'))
                 continue;
             int offset = Integer.parseInt(s.substring(1));
             if (position == 'A')
                 col -= offset;
             if (position == 'W')
                 row += offset;
             if (position == 'S')
                 row -= offset;
             if (position == 'D')
                 col += offset;
         }
         System.out.println(col + "," + row);
     }*/
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String[] in = bf.readLine().split(";");
        int x = 0;
        int y = 0;
        for(String s : in){
            // 不满足题目给定坐标规则
            if(!s.matches("[WASD][0-9]{1,2}")){
                continue;
            }
            int val = Integer.valueOf(s.substring(1));
            switch(s.charAt(0)){
                case 'W':
                    y += val;
                    break;
                case 'S':
                    y -= val;
                    break;
                case 'A':
                    x -= val;
                    break;
                case 'D':
                    x += val;
                    break;
            }
        }
        System.out.println(x+","+y);
    }
}


